//
//  YZDailyWorkModel.m
//  VET
//
//  Created by Lam BG on 2018/7/12.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import "YZDailyWorkModel.h"
#import "MJExtension.h"

@implementation YZDailyWorkModel

+ (NSDictionary*)mj_replacedKeyFromPropertyName {
    
    return @{
             @"dwID" : @"id"
             };
}

- (NSString *)showDeadTime {
 
    return [self getDateDisplayString:self.taskDeadline];
}

// 时间显示内容
-(NSString *)getDateDisplayString:(NSUInteger)seconds {
    
    NSDate *myDate = [NSDate dateWithTimeIntervalSince1970:seconds];
    NSDateFormatter *dateFmt = [[NSDateFormatter alloc ] init];
    
    // 指定日历对象,要去取日期对象的那些部分.
    NSCalendar *calendar = [ NSCalendar currentCalendar];
    NSDateComponents *comp =  [calendar components:NSCalendarUnitMonth|NSCalendarUnitDay|NSCalendarUnitWeekday fromDate:myDate];
    
    switch (comp.weekday) {
        case 1:
            dateFmt.dateFormat = @"MM月dd日 周日 HH:mm";
            break;
        case 2:
            dateFmt.dateFormat = @"MM月dd日 周一 HH:mm";
            break;
        case 3:
            dateFmt.dateFormat = @"MM月dd日 周二 HH:mm";
            break;
        case 4:
            dateFmt.dateFormat = @"MM月dd日 周三 HH:mm";
            break;
        case 5:
            dateFmt.dateFormat = @"MM月dd日 周四 HH:mm";
            break;
        case 6:
            dateFmt.dateFormat = @"MM月dd日 周五 HH:mm";
            break;
        case 7:
            dateFmt.dateFormat = @"MM月dd日 周六 HH:mm";
            break;
        default:
            break;
    }
    
    return [NSString stringWithFormat:@"%@ 截止", [dateFmt stringFromDate:myDate]];
}

@end
